package com.ihealthway.all.task;

import com.ihealthway.all.groupbuy.modules.wechat.WechatMPModule;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.log.Log;
import org.nutz.log.Logs;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

/**
 * 定时清除内存中的Web oauth code
 *
 * @author 凡梦星尘(elkan1788@gmail.com)
 * @since 2015/5/4
 */
@IocBean
public class ClearWebOauthCodeJob implements Job {

    private static final Log log = Logs.get();

    @Override
    public void execute(JobExecutionContext jec) throws JobExecutionException {

        log.info("Clear Wechat web oauth code start...");

        synchronized (this) {
            //TODO It's dangerous code
            WechatMPModule.WEB_AUTH_RESULT.clear();
        }

        log.info("Clear Wechat web oauth code success.");
    }
}
